import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { render } from 'react-dom'
import {
  applyRouterMiddleware,
  Route,
  IndexRoute,
  Router,
  hashHistory,
  withRouter,
} from 'react-router'
import { addLocaleData, IntlProvider, FormattedMessage } from 'react-intl'
import { Toast, Button } from 'antd-mobile'
import App from './App'
import { HomePage, RealLogin } from 'component/user'

import { PositionPage, PositionDetails, PositionModifyOrder} from 'component/position'
import { FinancePage } from 'component/finance'
import {
  TradePage,
  InterfaceSetting,
  TradeSearch,
  News,
  NoticeDetail,
  NewMarketOrder,
  SettingOrder
} from 'component/trade'
import {
  AccountPage,
  AccountCondition,
  HistoryAndLogList,
  DepositDraw,
  DepositResult
} from 'component/account'
import { ChatPage } from 'component/chat'

import 'appRoot/statics/less/app.less'

const routes = (
  <Route path="/" component={App}>
    {/* 首页 */}
    <IndexRoute component={HomePage}/>
    <Route path="/trade" component={TradePage} />
    <Route path="/trade/order" component={NewMarketOrder} />
    <Route path="/trade/settingorder" component={SettingOrder}/>
    <Route path="/position" component={PositionPage} />
    <Route path="/position/details" component={PositionDetails} />
    <Route path="/position/modifyorder" component={PositionModifyOrder} />
    <Route path="/reallogin" component={RealLogin} />
    <Route path="/account" component={AccountPage} />
    <Route path="/account/depositresult" component={DepositResult}/>
    <Route path="/account/condition" component={AccountCondition}/>
    <Route path="/account/history" component={HistoryAndLogList}/>
    <Route path="/account/depositdraw" component={DepositDraw}/>
    <Route path="/setting" component={InterfaceSetting} />
    <Route path="/trade/search" component={TradeSearch} />
    <Route path="/news" component={News} />
    <Route path="/notice/detail" component={NoticeDetail} />
    <Route path="/finance" component={FinancePage} />
    <Route path="/chat" component={ChatPage} />
  </Route>
)

render(
  <Router history={hashHistory} routes={routes} />,
  document.getElementById('app')
)
